from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from Objects.LoginPage import LoginPage

class LoginAction:

    def __init__(self):
        print('------Start Login--------')

    def login(self,wd,username,password):
        try:
            loginpage = LoginPage(wd)
            loginpage.click_Viplogin()
            loginpage.input_username(username)
            loginpage.input_password(password)
            loginpage.click_SubmitLogin()
        except Exception as e :
            raise e

if __name__ == '__main__':
    chromeDriver_path = 'E:\Python\chromedriver.exe'
    options = Options()
    options.add_argument('--start-maximized')
    wd = webdriver.Chrome(executable_path=chromeDriver_path, options=options)
    wd.get('http://www.cherryzqr.top/fsmarket/index.php')

    loginaction = LoginAction()
    loginaction.login(wd,'cherry1','123456')
    sleep(2)
    wd.quit()